
<div id="main">
<div id="contents_stat">
<form name="filters"  method="post" >
<br/>
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="cmenutitle">
<tr>
<td align="center">
<input type="hidden" name="downlogid" value="1" />
<textarea rows="24" cols="110" id="loginfo">
</textarea>
<input type="hidden" name="fileid" value="4" />
</td>
</tr>
</table>
<br/>
	<div class="submitFooter">
        <input sid="sbutton.clears" class="button" type="button" name="submit"/>
        <span style="padding-left:20px;">&#160;</span>
        <input sid="sbutton.down" class="button" type="button" name="id930" onclick="click930();disabled=true;"/>


</div>
</form>
</div>
</div>

<script type="text/javascript">
 /*   $(document).ready(function(){

        var cannotModify = msg.cannotModify1;
        var ifDelete = msg.deleteLog;
        var success = msg.dLogSuccess;
        var fail = msg.dLogFail;
        $("#loginfo").focus();
        showdownlog();
        $("[name=submit]").click(function () {
            if (confirm(ifDelete)) {
                $.ajax({
                    type: "POST",
                    url: modules["log_clear"] + '&id=' + $("input[name=downlogid]").val() + '&tmp=' + Math.random(),
                    dataType: "xml",
                    error: function (xml) {
                        $(xml).find('Error').each(function () {
                            var errortext = $(this).attr('msg');
                            // show_message("err",errortext);
                            alert(errortext);
                        });
                    },
                    success: function (xml) {
                        $(xml).find('rsp').each(function () {
                            var stat = $(this).attr('stat');
                            if (stat == "fail") {
                                $(xml).find('Error').each(function () {
                                    var code = $(this).attr('code');
                                    if (code == 4) {
                                        //show_message("err",cannotModify);
                                        alert(cannotModify);
                                    } else if (code == 5) {
                                        gotologin();
                                    } else {
                                        //show_message("err",fail);
                                        alert(fail);
                                    }
                                });
                            } else {
                                //show_message("success",success);
                                alert(success);
                                showdownlog();
                            }
                        });
                    }
                });
                return true;
            } else {
                return false;
            }
        });

    });*/

	
	function showdownlog() {
        var id =$('[name=downlogid]').val();
    if (id) {
        $.ajax({
            type: "POST",
            url: modules["log_download"]  +"&id="+ id + '&tmp=' + Math.random(),
            dataType: "xml",
            error: function (xml) {
                gotologin();
            },
            success: function (xml) {
                var stat = $(xml).find('rsp').attr('stat');
                if (stat == "ok") {
                    $(xml).find('item').each(function () {
                        var logfile = $(this).attr('value');
                        var url =  "/" + logfile;
                        $.get(url, function (data) {
                            $("#loginfo").html('');
                            var strArray = new Array();
                            var strArray = data.split("\n");
                            for (loop = 0; loop < strArray.length; loop++) {
                                if (strArray[loop]) {
                                    strArray[loop] = strArray[loop].replace("<", "&lt;");
                                    strArray[loop] = strArray[loop].replace(">", "&gt;");
                                    $("#loginfo").append(strArray[loop] + '<br/>\r\n');
                                }
                            }
                        });
                    });
                } else if (stat == "fail") {
                    var errorcode = $(xml).find('Error').attr('code');
                    if (errorcode == "5") {
                        gotologin();
                    }
                }
            }
        });
    }
}
	
	function click930() {
    $.ajax({
        type: "POST",
        url: modules["log_download"] +"&id="+ $("input[name=fileid]").val() + '&tmp=' + Math.random(),
        dataType: "xml",
        error: function (xml) {
            gotologin();
        },
        success: function (xml) {
            var errorcode = $(xml).find('Error').attr('code');
            if (errorcode == '5') {
                gotologin();
            } else {
                $(xml).find('item').each(function () {
                    var downfilename = $(this).attr('value');
                   window.location.href = downfilename;
                });
            }
        }
    });
}
</script>
